package com.siwei.mes.entity.excel;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.siwei.mes.entity.experiment.Experiment;
import com.siwei.mes.enums.EnturstReasonEnum;
import com.siwei.mes.enums.MaterialsEnum;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * 导入抗氯离子实体
 *
 * @Description: 导入抗氯离子实体
 * @Version: 1.0
 * @author: mlchen
 * @date: 2025/4/13 17:32
 */
@Data
@Accessors(chain = true)
public class ImportKllzExcel {
    @Excel(name = "流水号")
    private Integer index;
    @Excel(name = "委托编号")
    private String wtbh;
    @Excel(name = "样品编号")
    private String ypbh;
    @Excel(name = "生产日期")
    private Date scrq;
    @Excel(name = "施工单位")
    private String sgdw;
    @Excel(name = "工程名称")
    private String gcmc;
    @Excel(name = "施工部位")
    private String sgbw;
    @Excel(name = "强度等级")
    private String qddj;
    @Excel(name = "配合比编号")
    private String phbdh;
    @Excel(name = "报告编号")
    private String bgbh;
    @Excel(name = "试验员")
    private String syr;
    @Excel(name = "检验结果")
    private String jyjg;
    @Excel(name = "检验结果-胶凝总量")
    private String jyjgJnzl;
    @Excel(name = "环境条件")
    private String hjtj;
    @Excel(name = "技术指标")
    private String jszb;
    @Excel(name = "备注")
    private String remark;
    @Excel(name = "氯离子含量")
    private String llzhl;
    @Excel(name = "任务单号")
    private String rwdh;
    @Excel(name = "记录编号")
    private String jlbh;

    /**
     * 组装抗氯离子试验委托
     *
     * @param dataObject
     * @return
     */
    public static Experiment payloadExperimentInfo(ImportKllzExcel dataObject) {
        Experiment experiment = new Experiment();
        experiment.erpInit(true);
        experiment.setExperimentType(MaterialsEnum.CONCRETE.getCode());
        experiment.setEntrustTime(dataObject.getScrq());
        experiment.setExperimentTime(dataObject.getScrq());
        experiment.setSampleLevel(dataObject.getQddj());
        experiment.setMaterialsName(dataObject.getQddj());
        experiment.setEntrustReasonCode(EnturstReasonEnum.CJ.getCode());
        experiment.setEntrustReasonName(EnturstReasonEnum.CJ.getName());
        experiment.setPhb(dataObject.getPhbdh());
        experiment.setReportNo(dataObject.getBgbh());
        experiment.setReportDate(new Date());
        experiment.setIsQualified(1);//默认合格

        experiment.setEntrustPersonName(dataObject.getSyr());
        return experiment;
    }
}
